package com.ithei.date.mydate;

import java.util.Calendar;

public class CalendarDateTest {
    public static void main(String[] args) {
        Calendar c=Calendar.getInstance();
        int i = c.get(Calendar.YEAR);
        System.out.println("年数: "+i);
        int i1 = c.get(Calendar.MONTH);
        System.out.println("月份是:    "+(i1+1));
        int i2 = c.get(Calendar.DAY_OF_MONTH);
        System.out.println("月当中的天数: "+i2);
        int i3 = c.get(Calendar.DAY_OF_YEAR);
        System.out.println("年当中的天数: "+i3);
        int i4 = c.get(Calendar.DAY_OF_WEEK);
        System.out.println("这是星期:   "+(i4-1));
        c.set(2020,2,22,12,22,12);
        System.out.println("年:  "+c.get(Calendar.YEAR));
        System.out.println("月:  "+c.get(Calendar.MONTH));
        System.out.println("日:  "+c.get(Calendar.DATE));
    }
}
